package avicit.im.lantop.userauthset.rest;


import avicit.im.lantop.userauthset.service.UserAuthIntfsService;
import avicit.im.lantop.userauthset.service.api.UserAuthIntfsServiceApi;
import avicit.platform6.core.rest.msg.ResponseMsg;
import com.github.pagehelper.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(tags = "UserAuthIntfsService", description = "UserAuthIntfsService")
@RequestMapping("/api/avicit/im/lantop/userauthset/rest/UserAuthIntfsServiceRest")
public class UserAuthIntfsServiceRest {


    private static final Logger LOGGER = LoggerFactory.getLogger(UserAuthIntfsServiceRest.class);


    @Autowired
    private UserAuthIntfsService userAuthIntfsService;    //20160615



    @PostMapping("/getUserIdsAuthDatasByRecord")
    @ApiOperation(value = "通过数据id获得附件id")
    public ResponseMsg<Map<String, Object>> getUserIdsAuthDatasByRecord(@ApiParam(value = "通过数据id获得附件id", name = "map") @RequestBody Map<String,Object> map) {
        ResponseMsg<Map<String, Object>> responseMsg = new ResponseMsg<>();
        try {
            Map<String, Object> authmlParam = (Map<String, Object>) map.get("authmlParam");
            Map<String, Object> userIdsAuthDatasByRecord = userAuthIntfsService.getUserIdsAuthDatasByRecord(authmlParam);
            responseMsg.setResponseBody(userIdsAuthDatasByRecord);
            responseMsg.setRetCode("200");
        } catch (Exception e) {
            responseMsg.setRetCode("201");
            responseMsg.setErrorDesc(e.getMessage());
            e.printStackTrace();
        }
        return responseMsg;
    }
}
